<?php
namespace Admin\Controller;
class UploadController extends AdminBaseController {
   /***
    *@privilege Admin:上传->上传图片:72846838473
    */
    public function oneImage()
    {
        if(IS_POST){
            $upload = new \Think\Upload();// 实例化上传类
            $upload->maxSize   =     3145728 ;// 设置附件上传大小
            $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
            $upload->rootPath  =      './Public/upload/'; // 设置附件上传根目录
            // 上传单个文件
            $info   =   $upload->uploadOne($_FILES['file']);
            if(!$info) {// 上传错误提示错误信息
                $this->message($upload->getError(),0,true);
            }else{// 上传成功 获取上传文件信息
                $this->message($info['savepath'].$info['savename'],1,true);
            }
            print_g($_FILES);
        }else{
            $this->message('不合法的请求!',0);
        }
    }
    /***
    *@privilege Admin:上传->列表:19025316640
    */
    public function lis()
    {
        $where = 1;
        $result = $this->_list('Upload',$where,10);
        $this->assign($result);
        $this->_display('lis','上传列表');
    }
    /***
    *@privilege Admin:上传->删除:96100814090
    */
    public function del()
    {
        $this->_delAll('Upload');
    }

}